<template>
  <div id="app">
    <img
      class="logo-img"
      :src="logo"
    >
    <!-- 间距 img -->
    <!-- 间距 img -->
    <!-- 间距 img -->
    <!-- 间距 img -->

    <el-table
      :data="tableData"
      style="margin:10px 0;width: 100%;"
      border
      max-height="800"
      class="sticky-head"
      v-sticky="{ top: 0 }"
    >
      <el-table-column
        class-name='sticky'
        type="selection"
        width="55"
        fixed
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        type="index"
        label="行号"
        width="55"
        align="center"
        fixed
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="date"
        label="日期"
        width="180"
        fixed
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名1"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名2"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名3"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名4"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名5"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名6"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名7"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名8"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名9"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="name"
        label="姓名10"
        width="200"
      >
      </el-table-column>
      <el-table-column
        class-name='sticky'
        prop="address"
        label="地址"
        width="280"
        fixed="right"
      >
        <!-- fixed="right" -->
      </el-table-column>
    </el-table>

    <!-- 间距 img -->
    <!-- 间距 img -->
    <!-- 间距 img -->
    <img
      class="logo-img"
      :src="logo"
    >
    <img
      class="logo-img"
      :src="logo"
    >

    <img
      class="logo-img"
      :src="logo"
    >
    <img
      class="logo-img"
      :src="logo"
    >

    <router-view />
  </div>
</template>

<script>
import logo from '@/assets/logo.png'
export default {
  name: 'VSticky',
  data () {
    return {
      logo,
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 hao'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 hao'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 hao'
      }
      ]
    }
  },
  mounted () {
    // VueToastMobile.showToast('hellow,toast')
    // this.$toast.show('hello, toast')
  }
}
</script>

<style lang="scss">
// .sticky-head {
//   &.el-table {
//     overflow: visible;
//     .el-table__header-wrapper {
//       overflow: visible;
//       position: sticky;
//       top: 0;
//       z-index: 10;
//       table {
//         position: sticky;
//         top: 0;
//         thead {
//           position: relative;
//           th {
//             position: sticky;
//             top: 0;
//             z-index: 10;
//           }
//         }
//       }
//     }
//   }
// }

// .sticky {
//   vertical-align: top !important; //为了解决刚开始会定位在中间的问题
// }

// .sticky .cell {
//   position: sticky;
//   top: 0;
// }
</style>
